<template>
	<view class="loading" :style="{backgroundColor: bgColor}" v-if="loading">
		<view class="loading__box">
			<view class="loading__box--icon" v-if="!isAnimation">
				<image :src="image" mode=""></image>
			</view>
			<view class="loading__box--animation" v-else>
				<loading-animation/>
			</view>
			<view class="loading__box--text" :style="{color: fontColor}">{{text}}</view>
		</view>
	</view>
</template>

<script>
	import LoadingAnimation from '../loadingAnimation/loadingAnimation.vue'
	
	export default {
		components: {
			LoadingAnimation
		},
		data() {
			return {
				
			}
		},
		props: {
			loading: {
				type: Boolean,
				default: false
			},
			isAnimation: {
				type: Boolean,
				default: true
			},
			image: {
				type: String,
				default: ''
			},
			text: {
				type: String,
				default: '玩命加载中'
			},
			bgColor: {
				type: String,
				default: '#fff'
			},
			fontColor: {
				type: String,
				default: '#aaa'
			}
		},
		methods: {
			
		}
	}
</script>

<style scoped lang="scss">
	.loading {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 9999999999;
		display: flex;
		justify-content: center;
		align-items: center;
		
		&__box {
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			
			&--icon {
				width: 100rpx;
				height: 100rpx;
				
				image {
					width: 100%;
					height: 100%;
				}
			}
			
			&--text {
				text-align: center;
				font-size: 30rpx;
				color: #aaa;
				margin-top: 20rpx;
			}
		}
	}
</style>
